﻿Imports System.Net.Mail
Imports DLLDungChung
Public Class frm_dangkybanquyen

    Private Sub cmd_muamakichhoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_muamakichhoat.Click
        thongtinkhachhang_muabanquyen.Show()
    End Sub

    Private Sub Fr_dangkybanquyen_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
        frm_Login.Enabled = True
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If cauhinhmaytinh = txt_keybanquyen.Text Then
            MsgBox("Kích hoạt thành công")

            My.Computer.Registry.SetValue(
 "HKEY_CURRENT_USER\Software\AppStore", "banquyen", MaHoaDuLieu.mahoa(1))
            frm_Login.ktra()
            Me.Close()
            frm_Login.Enabled = True
            frm_Login.lbl_TBBanQuyen.Text = ("Phần mềm đã có bản quyền")
            My.Computer.Registry.SetValue(
"HKEY_CURRENT_USER\Software\AppStore", "banquyenfree", "hethan")
            My.Computer.Registry.SetValue(
"HKEY_CURRENT_USER\Software\AppStore", "thoigianfree", "hethan")
        Else
            MsgBox("Sai mã kích hoạt")
        End If
    End Sub


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If My.Computer.Registry.GetValue(
   "HKEY_CURRENT_USER\Software\AppStore", "thoigianfree", Nothing) = "hethan" Or My.Computer.Registry.GetValue(
   "HKEY_CURRENT_USER\Software\AppStore", "thoigianfree", Nothing) <> "" Then
            MsgBox("Bạn đã đăng ký rồi nhé")
            Button2.Hide()
        Else
            dkdungthu()
            Me.Close()
            frm_Login.Enabled = True
            frm_Login.lbl_TBBanQuyen.ForeColor = Color.Blue
            frm_Login.lbl_TBBanQuyen.Text = "Hết hạn sử dụng vào ngày" & MaHoaDuLieu.giaima(My.Computer.Registry.GetValue(
   "HKEY_CURRENT_USER\Software\AppStore", "thoigianfree", Nothing))
        End If
        frm_Login.cmd_ok.Enabled = True
    End Sub
End Class